package com.mythesis.bpel.ui.client.eventhandler;

import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.mythesis.bpel.ui.client.wrapper.ControlWrapper;

public class ControlKeydownHandler implements KeyDownHandler{

	protected ControlWrapper controlWrapper;
	
	public ControlWrapper getControlWrapper() {
		return controlWrapper;
	}

	public void setControlWrapper(ControlWrapper controlWrapper) {
		this.controlWrapper = controlWrapper;
	}

	@Override
	public void onKeyDown(KeyDownEvent event) {
		// TODO Auto-generated method stub
		if(event.getNativeKeyCode() == KeyCodes.KEY_DELETE){
			controlWrapper.clear();
			controlWrapper.removeFromParent();
		}
	}

}
